import path from 'path'
const MONGO_USERNAME = process.env.DB_USER || 'test'
const MONGO_PASSWORD = process.env.DB_PASS || '123456'
const MONGO_HOSTNAME = process.env.DB_HOST || '39.100.65.235'
const MONGO_PORT = process.env.DB_PORT || '27017'
const DB_NAME = process.env.DB_NAME || 'testdb'
const DB_URL = `mongodb://${MONGO_USERNAME}:${MONGO_PASSWORD}@${MONGO_HOSTNAME}:${MONGO_PORT}/${DB_NAME}`
// const DB_URL = 'mongodb://test:123456@127.0.0.1:27017/testdb'
const JWT_SECRET = 'rWSJd0lZWpH0Sl2XV5jcUssmKlK2fqJebfGZGeX8QkAjAu8KrIEofNyVuPZibfrBurrgvrhS4jNQhpZUnrf62VXPVXpKdxeHHeE'
const REDIS = {
  host: process.env.REDIS_HOST || '39.100.65.235',
  port: process.env.REDIS_PORT || 15001,
  password: process.env.REDIS_PASS || '123456'
}
const baseUrl = process.env.NODE_ENV === 'production' ? 'http://39.100.65.235' : 'http://localhost:8080'

const uploadPath = process.env.NODE_ENV === 'production' ? '/app/public' : path.join(path.resolve(__dirname), '../../public')
const isDevMode = process.env.NODE_ENV !== 'production'

const port = 3000
const wsPort = 3001
const adminEmail = ['95605355@qq.com']
const publicPath = [/^\/public/, /^\/login/, /^\/content/, /^\/user/, /^\/comments/]
export default {
  DB_URL,
  REDIS,
  JWT_SECRET,
  baseUrl,
  uploadPath,
  adminEmail,
  publicPath,
  isDevMode,
  port,
  wsPort
}
